﻿using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GUI
{
    public static class Constraint
    {
        public static void checkLenght(TextEdit txtName, KeyPressEventArgs e, int lenght)
        {
            if (!char.IsControl(e.KeyChar) && txtName.Text.Length > lenght)
            {
                e.Handled = true;
                MessageBox.Show("Kích thước quá dài");
                txtName.Text = "";
            }
        }
        public static void checkLenght(TextBox txtName, KeyPressEventArgs e, int lenght)
        {
            if (!char.IsControl(e.KeyChar) && txtName.Text.Length > lenght)
            {
                e.Handled = true;
                MessageBox.Show("Kích thước quá dài");
                txtName.Text = "";
            }
        }
    }
}
